package com.yuan.aopbefore;


import org.springframework.stereotype.Component;

@Component("calcImpl")
public class CalcImpl implements Calc{
    @Override
    public int add(int i, int j) {
//        System.out.println("==>add()加法执行之前,记录参数:i:"+i+",j:"+j);
        //验证i和j合法性
//        MyLogging.methodBefore("add",i,j);

        int rs = i + j;         //核心计算代码

//        MyLogging.methodAfter("add",rs);
//        System.out.println("==>add()加法执行之后,记录结果:"+rs);
        return rs;
    }

    @Override
    public int sub(int i, int j) {
//        System.out.println("==>sub()加法执行之前,记录参数:i:"+i+",j:"+j);
//        MyLogging.methodBefore("sub",i,j);
        int rs = i - j;
//        MyLogging.methodAfter("sub",rs);
//        System.out.println("==>sub()加法执行之后,记录结果:"+rs);
        return rs;
    }

    @Override
    public int mul(int i, int j) {
        int rs = i * j;
        return rs;
    }

    @Override
    public int div(int i, int j) {
        int rs = i / j;
        return rs;
    }
}
